package com.example.task1.ui.AllService.parking;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.example.task1.R;
import com.example.task1.bean.TakeoutFeedbackBean;
import com.example.task1.ui.BaseAdapter;

import java.util.ArrayList;
import java.util.List;

public class ParkingFeedbackAdapter extends BaseAdapter<TakeoutFeedbackBean.RowsBean> {

    private List<TakeoutFeedbackBean.RowsBean> mData = new ArrayList<>();
    private TextView tvTitle;
    private TextView tvContext;

    @Override
    public void setData(List<TakeoutFeedbackBean.RowsBean> rows) {
        int size = mData.size();
        mData.addAll(rows);
        notifyItemInserted(size);
    }

    @Override
    protected int getLayout() {
        return R.layout.takeoutfeedbacklist;
    }

    @Override
    protected Context getContext() {
        return null;
    }

    @Override
    protected List<TakeoutFeedbackBean.RowsBean> getData() {
        return mData;
    }

    @Override
    protected void onBind(myHolder holder, TakeoutFeedbackBean.RowsBean date) {
        tvTitle.setText(date.getTitle());
        tvContext.setText(date.getContent());
    }

    @Override
    protected void holder(View itemView) {
        initView(itemView);
    }

    private void initView(View itemView) {
        tvTitle = itemView.findViewById(R.id.tv_title);
        tvContext = itemView.findViewById(R.id.tv_context);
    }
}
